﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Web.UI.DataVisualization.Charting;
using System.Drawing;
using System.ComponentModel;
using System.Xml.Linq;
using Atendex.Dominio;

namespace Atendex.Web
{
    public partial class Relatorios : System.Web.UI.Page
    {
        DataTable dt;

        protected void Page_Load(object sender, EventArgs e)
        {
            dt = new DataTable();
            dt.Columns.Add(new DataColumn("Atendente"));
            dt.Columns.Add(new DataColumn("Atendimentos", typeof(Int32)));

            dt = CriaRow(dt, "Atendente_1", 5);
            dt = CriaRow(dt, "Atendente_2", 15);
            dt = CriaRow(dt, "Atendente_3", 9);

            grvDados.DataSource = dt;
            grvDados.DataBind();

            foreach (DataRow dr in dt.Rows)
            {
                Series serie = new Series(dr["Atendente"].ToString());
                serie.Points.AddY((int)dr["Atendimentos"]);

                // Add series into the chart's series collection
                crtGrafico.Series.Add(serie);
            }
        }

        public DataTable CriaRow(DataTable dt, string atendente, int num)
        {
            DataRow dr = dt.NewRow();
            dr["Atendente"] = atendente;
            dr["Atendimentos"] = num;

            dt.Rows.Add(dr);
            return dt;
        }

        protected void ddlRelatorio_SelectedIndexChanged(object sender, EventArgs e)
        {
            
        }
    }
}
